IdeaBlade.Linq Assembly > IdeaBlade.Linq Namespace > PredicateBuilder Class > And Method : And<T>(Expression<Func<T,Boolean>>,Expression<Func<T,Boolean>>) Method |
'Declaration
<ExtensionAttribute()> Public Overloads Shared Function And(Of T)( _ ByVal left As Expression(Of Func(Of T,Boolean)), _ ByVal right As Expression(Of Func(Of T,Boolean)) _ ) As Expression(Of Func(Of T,Boolean))
'Usage
Dim left As Expression(Of Func(Of T,Boolean)) Dim right As Expression(Of Func(Of T,Boolean)) Dim value As Expression(Of Func(Of T,Boolean)) value = PredicateBuilder.And(Of T)(left, right)
[Extension()] public static Expression<Func<T,bool>> And<T>( Expression<Func<T,bool>> left, Expression<Func<T,bool>> right )
public void AndQuery() { var mgr = new DomainModelEntityManager(); Expression<Func<Customer, bool>> crit1 = c => c.Country.Equals("Mexico"); Expression<Func<Customer, bool>> crit2 = c => c.CompanyName.StartsWith("A"); // Where companyname starts with A and country = mexico var finalcrit = crit1.And(crit2); var query = mgr.Customers.Where(finalcrit); var list = query.ToList(); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2